package com.fivebrms.commands
{
	import org.osflash.thunderbolt.Logger;
	
	import mx.rpc.events.ResultEvent;
	import mx.rpc.events.FaultEvent;
	import com.adobe.cairngorm.commands.Command;
	import com.adobe.cairngorm.control.CairngormEvent;
	import mx.controls.Alert;
	import flash.net.FileFilter;
	import flash.net.FileReferenceList;
    import flash.events.Event;
    import flash.net.URLRequest;
    import flash.net.URLRequestMethod;
    import mx.rpc.IResponder;
    import com.fivebrms.events.W9FormSendEvent;
    import com.fivebrms.model.MainModelLocator;
    import com.fivebrms.business.ConfidentialityDelegate;
    import com.fivebrms.vo.ConfidentialityVO;
    
	public class ConfidentialityCommand implements Command, IResponder
	{
		private var model : MainModelLocator = MainModelLocator.getInstance();
		
		public function execute( event : CairngormEvent ) : void
	 	{
			Logger.info("ConfidentialityDelegate ...execute..");
			var delegate : ConfidentialityDelegate = new ConfidentialityDelegate( this );
			
			Logger.info("start - calling java ConfidentialityCommand..");
			delegate.submitConfidentialityForm( model.confidentialityVO );
			Logger.info("end - called java ConfidentialityCommand..");
	 	}
	 	
		public function result( data : Object ) : void
		{
			Logger.info("ConfidentialityCommand.. result 1 ");
			Logger.info("ConfidentialityCommand.>result>.." + data.result.vendorName );			
			Logger.info("ConfidentialityCommand.>result>.." + data.result.vendorCode );
					
			var event : ResultEvent =  data as ResultEvent;
			Logger.info("ConfidentialityCommand.>result>.." + event.result.isSubmitted );
			
			//
			// copy the new rpc'ed transferred object back into the model
			//
			model.confidentialityVO = event.result as ConfidentialityVO;
		}
		
		public function fault( data : Object ) : void
		{
			Logger.info("ConfidentialityCommand.. fault 1 ");
			
			var event : FaultEvent = data as FaultEvent;
			Logger.info("ConfidentialityCommand.>fault>.." + event );
		}
	}
}